Skip to content

Conversation

@ax3l
Copy link
Member

@ax3l ax3l commented Jan 4, 2025

Add the implementation for the new small matrix (and small vector) types and their operators.

Specialize for now for the most common type we need in accelerator physics, a 6x6, F-ordered, 1-indexed matrix. (X-ref: BLAST-ImpactX/impactx#736, BLAST-ImpactX/impactx#743)

cc @cemitch99

@ax3l ax3l added the enhancement New feature or request label Jan 4, 2025
@ax3l ax3l requested a review from WeiqunZhang January 4, 2025 07:49
ax3l added 2 commits January 3, 2025 23:59
Add the implementation for the new small matrix (and small
vector) types and their operators.

Specialize for now for the most common type we need in
accelerator physics, a 6x6, F-ordered, 1-indexed matrix.
// but many libs, e.g. PyTorch, do not
// support read-only and will raise
// warnings, casting to read-write
d["data"] = py::make_tuple(std::intptr_t(&m.template get<0>()), read_only);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


auto sm = std::make_unique< SM >();
auto * src = static_cast<T*>(buf.ptr);
std::copy(src, src + buf.size, &sm->template get<0>());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WeiqunZhang same as above (re: start index not honored in .get)

@ax3l

This comment was marked as resolved.

@ax3l ax3l requested a review from EZoni January 6, 2025 02:07
@ax3l ax3l force-pushed the topic-small-matrix branch from d615266 to 44c82f0 Compare January 6, 2025 04:39
Comment on lines +25 to +29
/*
make_SmallMatrix< float const, NRows, NCols, ORDER, StartIndex >(m, "float_const");
make_SmallMatrix< double const, NRows, NCols, ORDER, StartIndex >(m, "double_const");
make_SmallMatrix< long double const, NRows, NCols, ORDER, StartIndex >(m, "longdouble_const");
*/

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
@ax3l ax3l merged commit 53483a4 into AMReX-Codes:development Jan 6, 2025
18 checks passed
@ax3l ax3l deleted the topic-small-matrix branch January 6, 2025 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants